package com.hwtx.form.domain.def;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import org.apache.commons.collections4.CollectionUtils;

import java.util.List;

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class TreeItem<T extends TreeItem<T>> {
    private String label;
    private Long value;
    private Long parentId;
    private List<T> children;

    public void setChildren(List<T> children) {
        if (CollectionUtils.isEmpty(children)) {
            return;
        }
        this.children = children;
    }
}
